﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess;
using EntityDaoLibrary;
using System.Data;

namespace BusinessRules
{
    public class RegisterInfoRules
    {
        /// <summary>
        /// 获取该信息实体
        /// </summary>
        /// <param name="inhosID"></param>
        /// <param name="syxh"></param>
        /// <param name="centerid"></param>
        /// <returns></returns>
        public DataSet GetRergisterInfo(string inhosID, string syxh, int centerid)
        {
            IDataAccess data = DataAccessFactory.instance.CreateDataAccess();
            data.Open();
            try
            {
                RegisterInfoDAO dao = new  RegisterInfoDAO(data);
                return  dao.GetRegistInfo(inhosID, syxh, centerid);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
            finally
            {
                data.Close();
            }
        }

        public DataSet FindAllMedicarePatientInfo()
        {
            IDataAccess data = DataAccessFactory.instance.CreateDataAccess();
            data.Open();
            try
            {
                RegisterInfoDAO dao = new RegisterInfoDAO(data);
                return dao.FindAllMedicarePatientInfo();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
            finally
            {
                data.Close();
            }
        }

        public DataSet FindbyRegistedPatientInfo()
        {
            IDataAccess data = DataAccessFactory.instance.CreateDataAccess();
            data.Open();
            try
            {
                RegisterInfoDAO dao = new RegisterInfoDAO(data);
                return dao.FindbyRegistedPatientInfo();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
            finally
            {
                data.Close();
            }
        }

       /// <summary>
       /// 根据条件查询所有结算的医保病人
       /// </summary>
       /// <param name="strWhere"></param>
       /// <returns></returns>
        public DataSet FindbyRegistedPatientInfo(string strWhere)
        {
            IDataAccess data = DataAccessFactory.instance.CreateDataAccess();
            data.Open();
            try
            {
                RegisterInfoDAO dao = new RegisterInfoDAO(data);
                return dao.FindbyRegistedPatientInfo(strWhere);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
            finally
            {
                data.Close();
            }
        }

        public DataSet FindbyRegistedPatientInfo(DateTime beginTime,DateTime endTime)
        {
            IDataAccess data = DataAccessFactory.instance.CreateDataAccess();
            data.Open();
            try
            {
                RegisterInfoDAO dao = new RegisterInfoDAO(data);
                return dao.FindbyRegistedPatientInfo(beginTime,endTime);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
            finally
            {
                data.Close();
            }
        }


        public DataSet FindbyRegistedPatientInfoByInhosID(string inhosid)
        {
            IDataAccess data = DataAccessFactory.instance.CreateDataAccess();
            data.Open();
            try
            {
                RegisterInfoDAO dao = new RegisterInfoDAO(data);
                return dao.FindbyRegistedPatientInfoByInhosID(inhosid);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
            finally
            {
                data.Close();
            }
        }
        public DataSet FindbyUnRegistPaientInfo()
        {
            IDataAccess data = DataAccessFactory.instance.CreateDataAccess();
            data.Open();
            try
            {
                RegisterInfoDAO dao = new RegisterInfoDAO(data);
                return dao.FindbyUnRegistPaientInfo();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
            finally
            {
                data.Close();
            }
        }
    }
}
